package cn.com.fattiger.framework.cms.admin.common.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.fattiger.framework.cms.admin.common.dao.MenuRepository;
import cn.com.fattiger.framework.cms.admin.common.model.Menu;
import cn.com.fattiger.framework.cms.admin.common.service.MenuService;

/**
 * Created by Administrator on 2015/12/1.
 */
@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    MenuRepository menuRepository;

    @Override
    public void addMenu(Menu menu) {
        menuRepository.save(menu);
    }

    @Override
    public Menu getMenu(Integer id) {
        return menuRepository.getMenuById(id);
    }

    @Override
    public List<Menu> getMenuByPid(Integer pid) {
        return menuRepository.findMenuByPid(pid);
    }

    @Override
    public void deleteMenu(Integer id) {
        menuRepository.delete(id);
    }

    @Override
    public List<Menu> queryMenus() {
        return menuRepository.findAll();
    }

    @Override
    public List<Menu> queryMenuByIdIn(List<Integer> ids) {
        return menuRepository.findMenuByIdIn(ids);
    }


}
